<?
    /* -*- Mode: PHP5; tab-width: 4; indent-tabs-mode: nil; basic-offset: 4 -*- */
    
    /*********************************************************
    *            --== InArch ==--
    *
    * Ajax Delete File
    *
    * @author Kulikov Alexey <a.kulikov@gmail.com>
    * @version n/a
    * @since 01.10.2005
    * @copyright essentialmind.com 2005
    *
    *********************************************************/

    /***
    * class ajaxDeleteFile
    ****
    * @package ajax
    * @author A Kulikov <a.kulikov@gmail.com>
    * @version n/a
    * @since 01.10.2005
    * @copyright essentialmind.com 2005
    ***/
    class ajaxDeleteFile extends ajaxAction{

        public function process(){
            
            $nodeid = (int)$_REQUEST['node'];
            $pageid = (int)$_REQUEST['page'];
            $name   = $_REQUEST['file'];
            
            //now check if there is already a property with that name at that level
            if($pageid > 0){
                $path = ROOT.'files'.DIRECTORY_SEPARATOR.'pages'.DIRECTORY_SEPARATOR.$pageid.DIRECTORY_SEPARATOR.$name;
                
            }else{
                $path = ROOT.'files'.DIRECTORY_SEPARATOR.'nodes'.DIRECTORY_SEPARATOR.$nodeid.DIRECTORY_SEPARATOR.$name;
                
            }
            
            @unlink($path);
           
            
            $this->r->status = true;
        }
    }
?>